<template>
    <div>
        <!-- 导航部分开始 -->
        <el-breadcrumb separator="/">
            <el-breadcrumb-item :to="{ path: '/' }">首页 </el-breadcrumb-item>>
            <el-breadcrumb-item>质量管理</el-breadcrumb-item>
            <el-breadcrumb-item>检测模版</el-breadcrumb-item>
        </el-breadcrumb>
        <!-- 导航部分结束 -->

        <!--  搜索栏开始 -->
        <el-form style="margin-top: 15px;" :inline="true" :model="queryTemplate" class="demo-form-inline">
            <el-form-item label="检测模版编号">
                <el-input v-model="queryTemplate.templateCode" placeholder="请输入检测项编码" clearable />

            </el-form-item>

            <el-form-item label="检测模版名称">
                <el-input v-model="queryTemplate.templateName" placeholder="请输入检测项名称" clearable />
            </el-form-item>

            <el-row>
                <el-col :span="24">
                     <el-form-item label="检测种类:">
                        <el-checkbox-group v-model="queryTemplate.templateType">
                            <el-checkbox label="[来料检验]" />
                            <el-checkbox label="[过程检验]" />
                            <el-checkbox label="[末检]" />
                            <el-checkbox label="[巡检]" />
                            <el-checkbox label="[成品检验]" />
                            <el-checkbox label="[发货检验]" />
                        </el-checkbox-group>
                    </el-form-item> </el-col>
            </el-row>



            <el-form-item>
                <el-button type="primary" @click="loadteTemplate">搜索</el-button>
                <el-button @click="resettingindex">重置</el-button>
            </el-form-item>
        </el-form>
        <!--  搜索栏结束 -->
        <!-- 工具栏开始 -->
        <div class="flex">
            <el-button title="新增" @click="this.addDialogVisible = true" type="primary"><el-icon>
                    <Plus />
                </el-icon>新增</el-button>
            <el-button color="#b3e19d" @click="handlerEditIndex" title="修改" type="primary"><el-icon>
                    <EditPen />
                </el-icon>修改</el-button>

            <el-button color="#f89898" @click="handlerDeleteIndex" title="删除" type="primary"><el-icon>
                    <Delete />
                </el-icon>删除</el-button>
        </div>

        <!-- 表格 开始 -->
        <el-table ref="templateTable" :data="templates" max-height="800px" :stripe="true" :border="true"
            style="width: 90%;margin-top: 10px;">
            <el-table-column type="selection" width="55" />
            <el-table-column label="检测模版编码" property="templateCode">
                <template #default="scope">
                    <el-link type="success" @click="showTemplateData(scope.row.templateId)">
                        {{ scope.row.templateCode }}
                    </el-link>
                </template>
            </el-table-column>
            <el-table-column label="检测模版名称" property="templateName" />
            <el-table-column label="检测种类" property="templateType" />
            <el-table-column label="是否启用" property="qcFlag">
                <template #default="scope">
                    <!-- scope.row 就是整行数据-->
                    <el-tag v-if="scope.row.qcFlag == 'y'" class="ml-2" type="success">是</el-tag>
                    <el-tag v-else="scope.row.qcFlag == 'n'" class="ml-2" type="danger">否</el-tag>
                </template>
            </el-table-column>
            <el-table-column width="330" align="center" label="操作">
                <template #default="scope">
                    <el-button size="small" @click="handleEditTemplate(scope.row)"><el-icon>
                            <EditPen />
                        </el-icon>编辑</el-button>
                    <el-popconfirm confirm-button-text="是" cancel-button-text="点错了" @confirm="handleDeleteTemplate(scope.row)"
                        title="您是否要删除这行数据">
                        <template #reference>
                            <el-button size="small" type="danger"><el-icon>
                                    <Delete />
                                </el-icon>删除</el-button>
                        </template>
                    </el-popconfirm>


                </template>
            </el-table-column>
        </el-table>
        <!-- 表格 结束 -->
        <!-- 分页栏开始 -->
        <el-pagination style="margin-top: 15px;" :page-size="templateLimit" :pager-count="templateMaxPage"
            @current-change="changePagetemplate" background layout="prev, pager, next" :total="templateTotal" />
        <!-- 分页栏结束 -->
        <!-- 添加弹窗窗体开始-->
        <el-dialog v-model="addDialogVisible" title="添加模版" width="600" align-center>
            <!-- 添加缺陷的表单 -->
            <el-form label-width="100px" :model="newTemplate" style="max-width: 460px">
                <el-form-item label="检测模版编号">
                    <el-input v-model="newTemplate.templateCode" />
                    <el-switch @change="autoGenTemplateCode" v-model="autoTemplateCode" class="ml-2"
                        style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949" />
                </el-form-item>

                <el-form-item label="检测模版名称">
                    <el-input v-model="newTemplate.templateName" placeholder="请输入检测项名称" clearable />
                </el-form-item>


                <el-form-item label="检测种类" prop="templateType">
                    <el-checkbox-group v-model="templateType">
                        <el-checkbox label="[来料检验]" />
                        <el-checkbox label="[过程检验]" />
                        <el-checkbox label="[末检]" />
                        <el-checkbox label="[巡检]" />
                        <el-checkbox label="[成品检验]" />
                        <el-checkbox label="[发货检验]" />
                    </el-checkbox-group>
                </el-form-item>
                <el-form-item label="是否启用">

                    <el-radio-group v-model="newTemplate.qcFlag" class="ml-4">
                        <el-radio :label="statu[0]" size="large">是</el-radio>
                        <el-radio :label="statu[1]" size="large">否</el-radio>
                    </el-radio-group>
                </el-form-item>


                <el-form-item label="备注">
                    <el-input v-model="newTemplate.templateRemark" :rows="2" type="textarea" />
                </el-form-item>


            </el-form>
            <template #footer>
                <span class="dialog-footer">
                    <el-button @click="cancelTemplate">取消</el-button>
                    <el-button type="primary" @click="doAddTemplate">
                        提交
                    </el-button>
                </span>
            </template>
        </el-dialog>
        <!-- 添加弹窗窗体结束-->
        <!-- 查看信息弹窗窗体开始-->
        <el-dialog v-model="DialogVisibles" title="查看模版信息" width="600" align-center>
            <!-- 添加缺陷的表单 -->
            <el-form label-width="100px" :model="lookTemplate" style="max-width: 460px">
                <el-form-item label="检测模版编号">
                    <el-input v-model="lookTemplate.templateCode" />
                </el-form-item>

                <el-form-item label="检测模版名称">
                    <el-input v-model="lookTemplate.templateName" placeholder="请输入检测项名称" clearable />
                </el-form-item>

                <el-form-item label="是否启用">

                    <el-radio-group v-model="lookTemplate.qcFlag" class="ml-4">
                        <el-radio :label="statu[0]" size="large">是</el-radio>
                        <el-radio :label="statu[1]" size="large">否</el-radio>
                    </el-radio-group>
                </el-form-item>


                <el-form-item label="备注">
                    <el-input v-model="lookTemplate.templateRemark" :rows="2" type="textarea" />
                </el-form-item>
            </el-form>

            <template #footer>
                <div sty le="flex: auto">
                    <el-button @click="cancelTemplateEdit">取消</el-button>
                    <el-button type="primary" @click="doTemplateReturn">返回</el-button>
                </div>
            </template>
        </el-dialog>
        <!-- 查看信息弹窗窗体结束-->

        <!-- 编辑抽屉弹窗开始 -->
        <el-dialog v-model="templateEditDrawer" title="编辑" width="80%" align-center>
            <template #header>
                <h4>编辑检测模版</h4>
            </template>
            <template #default>
                <div>
                    <!-- 编辑的表单 -->
                    <el-form label-width="100px" :model="editTemplate" style="max-width: 460px">
                        <el-form-item label="检测模版编号">
                            <el-input v-model="editTemplate.templateCode" />
                            <el-switch @change="autoGenTemplateCodes" v-model="autoTemplateCodes" class="ml-2"
                                style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949" />
                        </el-form-item>

                        <el-form-item label="检测模版名称">
                            <el-input v-model="editTemplate.templateName" placeholder="请输入检测项名称" clearable />
                        </el-form-item>

                        <el-form-item label="是否启用">

                            <el-radio-group v-model="editTemplate.qcFlag" class="ml-4">
                                <el-radio :label="statu[0]" size="large">是</el-radio>
                                <el-radio :label="statu[1]" size="large">否</el-radio>
                            </el-radio-group>
                        </el-form-item>


                        <el-form-item label="备注">
                            <el-input v-model="editTemplate.templateRemark" :rows="2" type="textarea" />
                        </el-form-item>

                    </el-form>
                </div>
                <!--=====================================编辑中嵌套表 -->
                <el-tabs type="border-card">
                    <!-- 检测项表格 -->
                    <el-tab-pane label="检测项">
                        <!-- 工具栏开始 -->
                        <div class="flex">
                            <el-button title="新增" @click="this.addDialogVisibleIndex = true" type="primary"><el-icon>
                                    <Plus />
                                </el-icon>新增</el-button>
                            <el-button color="#b3e19d" @click="handlerEdit" title="修改" type="primary"><el-icon>
                                    <EditPen />
                                </el-icon>修改</el-button>

                            <el-button color="#f89898" @click="handlerDelete" title="删除" type="primary"><el-icon>
                                    <Delete />
                                </el-icon>删除</el-button>
                        </div>
                        <!-- 工具栏结束 -->
                        <!-- 检测数据表格开始 -->
                        <el-table ref="indexDataTable" :data="templateIndexTable" max-height="800px" :stripe="true"
                            :border="true" style="width: 90%;margin-top: 10px;">
                            <el-table-column fixed align="center" type="selection" width="55" />
                            <el-table-column fixed align="center" label="检测项名称" property="indexName" />
                            <el-table-column align="center" label="检测项类型" property="indexType" />
                            <el-table-column align="center" label="检测工具" property="qcTool" />
                            <el-table-column align="center" label="检测方法" property="checkMethod" />
                            <el-table-column align="center" label="标准值" property="standerVal" />
                            <el-table-column align="center" label="单位" property="unitMeasure" />
                            <el-table-column align="center" label="误差上限" property="thresholdMax" />
                            <el-table-column align="center" label="误差下限" property="thresholdMin" />
                            <el-table-column width="150" label="操作">
                                <template #default="scope">
                                    <el-button size="small" @click="handleDataEditIndex(scope.row)">编辑</el-button>
                                    <el-popconfirm confirm-button-text="是" cancel-button-text="点错了"
                                        @confirm="handleDataDeleteIndex(scope.row)" title="您是否要删除这行数据">
                                        <template #reference>
                                            <el-button size="small" type="danger">删除</el-button>
                                        </template>
                                    </el-popconfirm>
                                </template>
                            </el-table-column>
                        </el-table>
                        <!-- 检测数据表格结束 -->
                    </el-tab-pane>

                    <!-- 物料表格 -->
                    <el-tab-pane label="物料产品">
                        <!-- 工具栏开始 -->
                        <div class="flex">
                            <el-button title="新增" @click="this.addDialogVisibleProduct = true" type="primary"><el-icon>
                                    <Plus />
                                </el-icon>新增</el-button>
                            <el-button color="#b3e19d" @click="handlerEditProduct" title="修改" type="primary"><el-icon>
                                    <EditPen />
                                </el-icon>修改</el-button>

                            <el-button color="#f89898" @click="handlerDeleteProduct" title="删除" type="primary"><el-icon>
                                    <Delete />
                                </el-icon>删除</el-button>
                        </div>
                        <!-- 工具栏结束 -->

                        <!-- 产品数据表格开始 -->
                        <el-table ref="ProductDataTable" :data="templateIndexProduct" max-height="800px" stripe="true"
                            border="true" style="width: 100%;margin-top: 10px;">
                            <el-table-column align="center" type="selection" width="55" />
                            <el-table-column align="center" label="产品物料编号" property="itemCode" />
                            <el-table-column align="center" label="产品物料名称" property="itemName" />
                            <el-table-column align="center" label="规格型号" property="specification" />
                            <el-table-column align="center" label="最低检测数" property="quantityCheck" />
                            <el-table-column align="center" label="单位" property="unitMeasure" />
                            <el-table-column align="center" label="最大不合格数" property="quantityUnqualified" />
                            <el-table-column align="center" label="最大致命缺陷率" property="crRate" />
                            <el-table-column align="center" label="最大严重缺陷率" property="majRate" />
                            <el-table-column align="center" label="最大轻微缺陷率" property="minRate" />
                            <el-table-column width="150" align="center" label="操作">
                                <template #default="scope">
                                    <el-button size="small" @click="handleDataEditProdect(scope.row)">编辑</el-button>
                                    <el-popconfirm confirm-button-text="是" cancel-button-text="点错了"
                                        @confirm="handleDataDeleteProduct(scope.row)" title="您是否要删除这行数据">
                                        <template #reference>
                                            <el-button size="small" type="danger">删除</el-button>
                                        </template>
                                    </el-popconfirm>
                                </template>
                            </el-table-column>
                        </el-table>
                        <!-- 产品数据表格结束 -->

                    </el-tab-pane>
                </el-tabs>

                <!--检测项开始 -->
                <!-- 添加检测弹窗窗体开始-->
                <el-dialog v-model="addDialogVisibleIndex" title="添加检测" width="55%" align-center>
                    <!-- 添加检测的表单 -->
                    <el-form label-width="100px" :model="newTemplateIndex" style="max-width: 460px">
                        <el-form-item label="检测项">
                            <el-input v-model="newTemplateIndex.indexName" disabled class="input-with-select">
                                <template #append>
                                    <el-button @click="this.searchIndex = true" type="primary"><el-icon>
                                            <Search />
                                        </el-icon></el-button>
                                </template>
                            </el-input>
                        </el-form-item>

                        <el-form-item label="检测工具">
                            <el-input v-model="newTemplateIndex.qcTool" disabled learable />
                        </el-form-item>

                        <el-form-item label="检测要求">
                            <el-input v-model="newTemplateIndex.checkMethod" :rows="2" type="textarea" />
                        </el-form-item>
                        <el-form-item label="标准值">
                            <el-input v-model="newTemplateIndex.standerVal" />
                        </el-form-item>
                        <el-form-item label="单位">
                            <el-select v-model="newTemplateIndex.unitMeasure" placeholder="请选择检测项类型">
                                <el-option label="公斤" value="公斤" />
                                <el-option label="个" value="个" />
                                <el-option label="箱" value="箱" />
                                <el-option label="米" value="米" />
                                <el-option label="厘米" value="厘米" />
                                <el-option label="毫米" value="毫米" />
                                <el-option label="吨" value="吨" />
                                <el-option label="瓶" value="瓶" />
                                <el-option label="公尺" value="公尺" />
                                <el-option label="捆" value="捆" />
                            </el-select>
                        </el-form-item>
                        <el-form-item label="误差上限">
                            <el-input-number v-model="newTemplateIndex.thresholdMax" :min="0" />
                        </el-form-item>

                        <el-form-item label="误差下限">
                            <el-input-number v-model="newTemplateIndex.thresholdMin" :max="0" />

                        </el-form-item>
                        <el-form-item label="说明图">
                            <el-input v-model="newTemplateIndex.docUrl" placeholder="请输入说明图" />
                        </el-form-item>


                        <el-form-item label="备注">
                            <el-input v-model="newTemplateIndex.tempRemark" :rows="2" type="textarea" />
                        </el-form-item>

                    </el-form>
                    <template #footer>
                        <span class="dialog-footer">
                            <el-button @click="cancelTemplateIndex">取消</el-button>
                            <el-button type="primary" @click="doAddTemplateIndex">
                                提交
                            </el-button>
                        </span>
                    </template>
                </el-dialog>
                <!-- 添加弹窗窗体结束-->
                <!-- 检测编辑弹窗开始 -->
                <el-dialog v-model="indexEditDrawerIndex" title="编辑检测" width="600" align-center>
                    <template #header>
                        <h4>编辑缺陷</h4>
                    </template>
                    <template #default>
                        <div>
                            <!-- 编辑缺陷的表单 -->
                            <el-form label-width="100px" :model="updateTemplateIndex" style="max-width: 460px">
                                <el-form-item label="检测项">
                                    <el-input v-model="updateTemplateIndex.indexName" disabled class="input-with-select">
                                        <template #append>
                                            <el-button @click="this.searchIndex = true" type="primary"><el-icon>
                                                    <Search />
                                                </el-icon></el-button>
                                        </template>
                                    </el-input>
                                </el-form-item>

                                <el-form-item label="检测工具">
                                    <el-input v-model="updateTemplateIndex.qcTool" disabled learable />
                                </el-form-item>

                                <el-form-item label="检测要求">
                                    <el-input v-model="updateTemplateIndex.checkMethod" :rows="2" type="textarea" />
                                </el-form-item>
                                <el-form-item label="标准值">
                                    <el-input v-model="updateTemplateIndex.standerVal" />
                                </el-form-item>
                                <el-form-item label="单位">
                                    <el-select v-model="updateTemplateIndex.unitMeasure" placeholder="请选择检测项类型">
                                        <el-option label="公斤" value="公斤" />
                                        <el-option label="个" value="个" />
                                        <el-option label="箱" value="箱" />
                                        <el-option label="米" value="米" />
                                        <el-option label="厘米" value="厘米" />
                                        <el-option label="毫米" value="毫米" />
                                        <el-option label="吨" value="吨" />
                                        <el-option label="瓶" value="瓶" />
                                        <el-option label="公尺" value="公尺" />
                                        <el-option label="捆" value="捆" />
                                    </el-select>
                                </el-form-item>
                                <el-form-item label="误差上限">
                                    <el-input-number v-model="updateTemplateIndex.thresholdMax" :min="0" />
                                </el-form-item>

                                <el-form-item label="误差下限">
                                    <el-input-number v-model="updateTemplateIndex.thresholdMin" :max="0" />

                                </el-form-item>
                                <el-form-item label="说明图">
                                    <el-input v-model="updateTemplateIndex.docUrl" placeholder="请输入说明图" />
                                </el-form-item>


                                <el-form-item label="备注">
                                    <el-input v-model="updateTemplateIndex.tempRemark" :rows="2" type="textarea" />
                                </el-form-item>

                            </el-form>
                        </div>
                    </template>
                    <template #footer>
                        <div style="flex: auto">
                            <el-button @click="cancelEdits">取消</el-button>
                            <el-button type="primary" @click="doIndexEdits">提交</el-button>
                        </div>
                    </template>
                </el-dialog>
                <!-- 编辑的弹窗结束 -->
                <!-- 检测搜索弹窗窗体开始-->
                <el-dialog v-model="searchIndex" title="检测项选择" width="55%" align-center>

                    <!--  搜索栏开始 -->
                    <el-form style="margin-top: 15px;" :inline="true" :model="queryIndex" class="demo-form-inline">
                        <el-form-item label="检测项名称">
                            <el-input v-model="queryIndex.indexName" placeholder="请输入检测项名称" clearable />
                        </el-form-item>

                        <el-form-item label="检测项类型">
                            <el-select v-model="queryIndex.indexType" placeholder="请选择检测项类型">
                                <el-option label="尺寸" value="尺寸" />
                                <el-option label="外观" value="外观" />
                                <el-option label="重量" value="重量" />
                                <el-option label="性能" value="性能" />
                                <el-option label="成分" value="成分" />
                            </el-select>
                        </el-form-item>

                        <el-form-item>
                            <el-button type="primary" @click="loadindex">搜索</el-button>
                            <el-button @click="resetting">重置</el-button>

                        </el-form-item>
                    </el-form>
                    <!--  搜索栏结束 -->
                    <!-- 表格开始 -->
                    <el-table ref="indexTable" :data="indexs" max-height="800px" :stripe="true" :border="true"
                        style="width: 90%;margin-top: 10px;">
                        <el-table-column type="selection" width="55" />
                        <el-table-column label="检测项编码" property="indexCode" />
                        <el-table-column label="检测项名称" property="indexName" />
                        <el-table-column label="检测项类型" property="indexType" />
                        <el-table-column label="检测工具" property="qcTool" />
                    </el-table>
                    <!-- 表格 结束 -->
                    <template #footer>
                        <span class="dialog-footer">
                            <el-button @click="cancelTempIndex">取消</el-button>
                            <el-button type="primary" @click="doAddTempIndex">
                                提交
                            </el-button>
                        </span>
                    </template>
                    <!-- 分页栏开始 -->
                    <el-pagination style="margin-top: 15px;" :page-size="indexLimit" :pager-count="indexMaxPage"
                        @current-change="changePageIndex" background layout="prev, pager, next" :total="indexTotal" />
                    <!-- 分页栏结束 -->
                </el-dialog>
                <!--搜索检测弹窗窗体结束 -->
                <!--检测结束 -->
                <!-- 产品物料开始 -->
                <!-- 添加物料弹窗窗体开始-->
                <el-dialog v-model="addDialogVisibleProduct" title="添加物料" width="55%" align-center>
                    <!-- 添加物料的表单 -->
                    <el-form label-width="100px" :model="newTemplateProduct" style="max-width: 460px">
                        <el-form-item label="产品物料编码">
                            <el-input v-model="newTemplateProduct.itemCode" disabled>
                                <template #append>
                                    <el-button @click="this.searchProduct = true" type="primary"><el-icon>
                                            <Search />
                                        </el-icon></el-button>
                                </template>
                            </el-input>
                        </el-form-item>

                        <el-form-item label="产品物料名称">
                            <el-input v-model="newTemplateProduct.itemName" disabled placeholder="请输入检测项名称" clearable />
                        </el-form-item>

                        <el-form-item label="规格型号">
                            <el-input v-model="newTemplateProduct.specification" :rows="2" type="textarea" />
                        </el-form-item>

                        <el-form-item label="最低检测数">
                            <el-input-number v-model="newTemplateProduct.quantityCheck" :min="0" />
                        </el-form-item>

                        <el-form-item label="最大不合格数">
                            <el-input-number v-model="newTemplateProduct.quantityUnqualified" :min="0" />
                        </el-form-item>

                        <el-form-item label="单位">
                            <el-input v-model="newTemplateProduct.unitMeasure" :rows="2" type="textarea" />

                        </el-form-item>
                        <el-form-item label="最大致命缺陷率">
                            <el-input-number v-model="newTemplateProduct.crRate" :min="0" />
                        </el-form-item>

                        <el-form-item label="最大严重缺陷率">
                            <el-input-number v-model="newTemplateProduct.majRate" :min="0" />
                        </el-form-item>

                        <el-form-item label="最大轻微缺陷率">
                            <el-input-number v-model="newTemplateProduct.minRate" />
                        </el-form-item>

                        <el-form-item label="备注">
                            <el-input v-model="newTemplateProduct.productRemark" :rows="2" type="textarea" />
                        </el-form-item>

                    </el-form>
                    <template #footer>
                        <span class="dialog-footer">
                            <el-button @click="cancelTemplateProduct">取消</el-button>
                            <el-button type="primary" @click="doAddTemplateProduct">
                                提交
                            </el-button>
                        </span>
                    </template>
                </el-dialog>
                <!-- 添加物料弹窗窗体结束-->
                <!-- 物料编辑弹窗开始 -->
                <el-dialog v-model="indexEditDrawerProduct" title="编辑产品物料" width="600" align-center>
                    <template #header>
                        <h4>编辑产品物料</h4>
                    </template>
                    <template #default>
                        <div>
                            <!-- 编辑产品物料表单开始 -->
                            <el-form label-width="100px" :model="updateTemplateProduct" style="max-width: 460px">
                                <el-form-item label="产品物料编码">
                                    <el-input v-model="updateTemplateProduct.itemCode" disabled>
                                        <template #append>
                                            <el-button @click="this.searchProduct = true" type="primary"><el-icon>
                                                    <Search />
                                                </el-icon></el-button>
                                        </template>
                                    </el-input>
                                </el-form-item>

                                <el-form-item label="产品物料名称">
                                    <el-input v-model="updateTemplateProduct.itemName" disabled placeholder="请输入检测项名称"
                                        clearable />
                                </el-form-item>

                                <el-form-item label="规格型号">
                                    <el-input v-model="updateTemplateProduct.specification" :rows="2" type="textarea" />
                                </el-form-item>

                                <el-form-item label="最低检测数">
                                    <el-input-number v-model="updateTemplateProduct.quantityCheck" :min="0" />
                                </el-form-item>

                                <el-form-item label="最大不合格数">
                                    <el-input-number v-model="updateTemplateProduct.quantityUnqualified" :min="0" />
                                </el-form-item>

                                <el-form-item label="单位">
                                    <el-input v-model="updateTemplateProduct.unitMeasure" :rows="2" type="textarea" />

                                </el-form-item>
                                <el-form-item label="最大致命缺陷率">
                                    <el-input-number v-model="updateTemplateProduct.crRate" :min="0" />
                                </el-form-item>

                                <el-form-item label="最大严重缺陷率">
                                    <el-input-number v-model="updateTemplateProduct.majRate" :min="0" />

                                </el-form-item>

                                <el-form-item label="最大轻微缺陷率">
                                    <el-input-number v-model="updateTemplateProduct.minRate" />
                                </el-form-item>

                                <el-form-item label="备注">
                                    <el-input v-model="updateTemplateProduct.productRemark" :rows="2" type="textarea" />
                                </el-form-item>

                            </el-form>
                        </div>
                    </template>
                    <template #footer>
                        <div style="flex: auto">
                            <el-button @click="cancelEditsProduct">取消</el-button>
                            <el-button type="primary" @click="doProductEdits">提交</el-button>
                        </div>
                    </template>
                </el-dialog>

                <!-- 物料编辑弹窗结束 -->
                <!-- 搜索物料的弹窗窗体开始 -->
                <el-dialog v-model="searchProduct" title="物料选择" width="80%" align-center>
                    <el-container>
                        <el-aside width="200px">
                            <!-- 分类树 -->
                            <el-tree ref="tree" :data="itemTypes" :expand-on-click-node="false" node-key="itemTypeId"
                                :props="defaultProps" @node-click="optionItemByTree" default-expand-all
                                style=" font-size: 15px;" />
                        </el-aside>
                        <el-main>
                            <!-- 搜索栏开始 -->
                            <el-form :inline="true" :model="search" class="demo-form-inline">
                                <el-form-item label="物料编码">
                                    <el-input v-model="search.itemCode" placeholder="请输入物料编码" />
                                </el-form-item>
                                <el-form-item label="物料名称">
                                    <el-input v-model="search.itemName" placeholder="请输入物料名称" />
                                </el-form-item>
                                <el-form-item>
                                    <el-button type="primary" @click="loadItem"><el-icon>
                                            <search />
                                        </el-icon>搜索</el-button>
                                    <el-button @click="handleReset"><el-icon>
                                            <refresh />
                                        </el-icon>重置</el-button>
                                </el-form-item>
                            </el-form>
                            <!-- 搜索栏结束 -->

                            <!-- 表格 开始 -->
                            <el-table ref="itemTable" :data="items" max-height="80%" style="margin-top: 10px;">
                                <el-table-column type="selection" width="55" />
                                <el-table-column label="物料编码" property="itemCode" width="90" />
                                <el-table-column label="物料名称" property="itemName" width="120" />
                                <el-table-column label="规格型号" property="specification" width="100" />
                                <el-table-column label="单位" property="unitOfMeasure" width="70" />
                                <el-table-column label="物料/产品" property="itemOrProduct" width="110" />
                                <el-table-column label="所属分类" property="itemTypeName" width="100" />
                                <el-table-column label="创建时间" :formatter="timeFormatter" property="createTimeMillis" />

                            </el-table>
                            <!-- 表格 结束 -->
                            <template #footer>
                                <span class="dialog-footer">
                                    <el-button @click="cancelAdd">取消</el-button>
                                    <el-button type="primary" @click="doAdd">提交</el-button>
                                </span>
                            </template>

                        </el-main>
                    </el-container>
                    <template #footer>
                        <span class="dialog-footer">
                            <el-button @click="cancelUpdate">取消</el-button>
                            <el-button type="primary" @click="doUpdate">提交</el-button>
                        </span>
                    </template>


                </el-dialog>
                <!-- 搜索物料的弹窗窗体结束 -->



                <!-- 产品物料结束 -->
                <!--编辑中嵌套表结束-================================== -->
            </template>
            <template #footer>
                <div sty le="flex: auto">
                    <el-button @click="cancelEdit">取消</el-button>
                    <el-button type="primary" @click="doTemplateEdit">提交</el-button>
                </div>
            </template>
        </el-dialog>
        <!-- 编辑抽屉弹窗结束 -->



    </div>
</template>

<script>
import templateRequst from '../../../api/templates-api.js';
import genIdRequst from '../../../api/qcGenId-api.js';
import indexRequst from '../../../api/index-api.js';
import templateIndexRequst from '../../../api/templateIndex-api.js';
import itemTypeRequest from "../../../api/md-item-type";
import mdItemRequest from "../../../api/md-item";
import tools from '../../../util/tools';
import templatesProductRequst from '../../../api/templatesProduct-api.js';




export default {
    data() {
        return {
            queryTemplate: {},//查询模版对象
            templates: [],//模版列表
            templateCurrPage: 1, //  分页的当前页码
            templateLimit: 10, // 分页的每页大小
            templateTotal: 0, //  列表的总条数
            templateMaxPage: 1,//  列表的最大页码
            newTemplate: {},//封装新增
            addDialogVisible: false,//增加窗口
            autoTemplateCode: false,//新增自动生成按钮
            newTemplate: {
                templateCode: undefined,//自动生成编码
                "templateType": "",//增加多选检测种类
            },
            statu: ['y', 'n'],
            templateType: [],
            editTemplate: {},//编辑对象
            templateEditDrawer: false,//编辑对象窗口
            editTemplate: {
                templateCode: undefined,
            },
            autoTemplateCodes: false,//编辑自动生成编码按钮
            DialogVisibles: false,//查看信息弹窗
            lookTemplate: {},//封装查看信息

            // =====检测======================
            templateIndexTable: [],//检测项表格
            addDialogVisibleIndex: false,//新增检测项窗口
            newTemplateIndex: {},//封装检测项新增 
            searchIndex: false,//检测增加弹窗的搜索按钮
            queryIndex: {},//搜索检测对象
            indexs: [],//搜索检测列表
            indexCurrPage: 1, // 字典分页的当前页码
            indexLimit: 10, // 字典分页的每页大小
            indexTotal: 0, // 字典列表的总条数
            indexMaxPage: 1,// 字典列表的最大页码
            updateTemplateIndex: {},//封装检测编辑按钮
            currTempalateIndex: {},
            indexEditDrawerIndex: false,//检测编辑窗口

            //========物料============================
            templateIndexProduct: [],//物料产品表格
            currTemplateProduct: {},
            addDialogVisibleProduct: false,//新增物料弹窗
            newTemplateProduct: {},//新增物料窗口
            searchProduct: false,//物料新增窗口搜索弹窗

            search: {},//搜索物料对象
            itemTypes: [],// 分类菜单的所有数据
            defaultProps: {
                children: 'children',// 孩子节点集合的属性名
                label: 'itemTypeName',// 对应的文本的属性名
            },
            // 分页数据
            page: 1, // 页数
            limit: 10, // 每页条数
            total: 0, // 总条数
            maxPageNum: 1, // 最大页数
            items: [], // 查询到的数据
            templateIndexTable: [],//检测数据列表
            templateIndexProduct: [],//产品数据表
            indexEditDrawerProduct: false,//编辑产品物料的窗口
            updateTemplateProduct: {},//封装物料编辑表单数据


        }
    },
    methods: {
        // ===============产品物料开始=====================================
        //多选删除按钮
        handlerDeleteProduct() {
            // 获取表格对象
            let table = this.$refs.ProductDataTable;
            // 通过API获取被选中的数据 
            let selectionRows = table.getSelectionRows();
            if (selectionRows == undefined || selectionRows.length == 0) {
                this.$message({
                    type: "info",
                    message: "您没有选中任何行"
                });
            }
            // console.log(selectionRows);
            // 可以进行批量改删除了
            //批量删除的第一件事
            //生产一个要删除的userId的数组
            let recordIds = [];

            //forEach 指的是从数组每一次取值是会赋值给user
            selectionRows.forEach(record => {
                // console.log(defect);
                recordIds.push(record.recordId);
            });
            console.log(recordIds);
            //调用API进行删除
            templatesProductRequst.deletes(recordIds, res => {
                this.$message({
                    type: "success",
                    message: "成功删除" + res.msg + "条数据"
                });
                this.loadTemplateProduct(this.updateTemplateProduct.templateId);

            });
        },

        //行物料删除
        handleDataDeleteProduct(row) {

            templatesProductRequst.delete(row.recordId, res => {
                if (res.code == 200) {
                    this.$message({
                        type: "success",
                        message: "删除成功"
                    });
                    this.loadTemplateProduct(this.updateTemplateProduct.templateId);
                } else {
                    this.$message({
                        type: "error",
                        message: "删除失败"
                    });
                }
            })


        },
        //多选修改按钮
        handlerEditProduct() {
            // 获取表格对象
            let table = this.$refs.ProductDataTable;
            // 通过API获取被选中的数据 
            let selectionRows = table.getSelectionRows();
            if (selectionRows == undefined || selectionRows.length == 0) {
                this.$message({
                    type: "info",
                    message: "您没有选中任何行"
                });
            }
            // 获取第一行数据
            let row = selectionRows[0];
            // 调用行编辑事件
            this.handleDataEditProdect(row);

        },

        //编辑的取消按钮
        cancelEditsProduct() {
            //关闭窗体
            this.indexEditDrawerProduct = false;
            //将数据制空
            this.updateTemplateProduct = {};

        },
        //编辑的提交按钮
        doProductEdits() {
            // 提交editIndex即可
            templatesProductRequst.edit(this.updateTemplateProduct, res => {
                // 这里的res就是我们的后端返回的perResult对象
                if (res.code == '200') {
                    this.$message({
                        message: '编辑成功',
                        type: 'success'
                    });
                    //关闭窗体
                    this.indexEditDrawerProduct = false;
                    // 重新加载数据
                    this.loadTemplateProduct(this.updateTemplateProduct.templateId);
                    // 将editIndex制空
                    this.updateTemplateProduct = {};
                } else if (res.code == '300') {
                    this.$message({
                        message: '检测名称重复',
                        type: 'warning',
                    });
                } else {
                    this.$message({
                        message: '编辑失败',
                        type: 'error',
                    });
                }
            });
        },
        //物料行编辑按钮
        handleDataEditProdect(row) {
            //通过id加载要编辑的信息
            templatesProductRequst.gets(row.recordId, res => {
                // 将查询的用户信息设置到editUser中
                this.updateTemplateProduct = res.data;

                console.log(res.data);
                // 显示抽屉弹窗
                this.indexEditDrawerProduct = true;
            });



        },
        //物料添加取消
        cancelTemplateProduct() {
            //将数据制空
            this.currTemplateProduct = {},
                //关闭窗体
                this.addDialogVisibleProduct = false;
        },
        //物料确定按钮
        doAddTemplateProduct() {
            this.newTemplateProduct.templateId = this.currTemplateProduct.templateId;
            // this.newTemplateIndex.templateId = 
            // console.log(currRouteProcess.templateId);
            templatesProductRequst.save(this.newTemplateProduct, res => {
                // 这里的res就是我们的后端返回的perResult对象
                if (res.code == '200') {
                    this.$message({
                        message: '添加成功',
                        type: 'success'
                    });
                    //关闭窗体
                    this.addDialogVisibleProduct = false;
                    this.loadTemplateProduct(this.currTemplateProduct.templateId);
                    // 将newDefect制空
                    this.newTemplateProduct = {};

                } else {
                    this.$message({
                        message: '添加失败',
                        type: 'error',
                    });
                }
            });
        },

        //加载检测数据信息
        loadTemplateProduct(templateId) {
            console.log(templateId);
            templatesProductRequst.get(templateId, res => {
                console.log(res.data);
                this.templateIndexProduct = res.data;
            });
        },


        //搜索物料弹窗取消按钮
        cancelUpdate() {
            this.searchProduct = false;//关闭窗体

        },
        //搜索物料提交按钮
        doUpdate() {
            let table = this.$refs.itemTable; // 获取新增的表格对象
            let rows = table.getSelectionRows(); // 通过API获取被选中的数据
            this.newTemplateProduct.itemCode = rows[0].itemCode;
            this.newTemplateProduct.itemName = rows[0].itemName;
            this.newTemplateProduct.unitMeasure = rows[0].unitOfMeasure;
            console.log(this.newTemplateProduct.intemCode);

            this.updateTemplateProduct.itemCode = rows[0].itemCode;
            this.updateTemplateProduct.itemName = rows[0].itemName;
            this.updateTemplateProduct.unitMeasure = rows[0].unitOfMeasure;
            console.log(this.updateTemplateProduct.intemCode);
            this.searchProduct = false;

            //重新加载数据
            this.loadItemType();
            this.loadItem();

        },
        // 点击分页事件
        changePage(val) {
            this.page = val;
            this.loadItem();
        },
        //新增按钮事件
        handleAdd() {
            this.addItemDialogVisible = true;
            mdItemRequest.getByAncestors(res => {
                this.itemType = res.data;
            })
        },
        //条件搜索重置按钮事件
        handleReset() {
            this.search = {};
            this.loadItem();
        },
        //初始化时间
        timeFormatter(row, column, cellValue) {
            return tools.timeMillisToString(cellValue);
        },
        //加载搜索物料数据
        loadItem() {
            mdItemRequest.list(this.page, this.limit, this.search, res => {
                this.items = res.data.list;
                this.total = res.data.total;
                this.maxPageNum = res.data.pages;
            })
        },
        //加载搜索树物料信息
        loadItemType(isReal) {
            if (this.itemTypes == undefined || this.itemTypes.length == 0 || isReal) {
                itemTypeRequest.listTree(res => {
                    this.itemTypes = res.data;
                })
            }
        },

        // =========================检测开始====================================
        //多删除
        handlerDelete() {
            // 获取表格对象
            let table = this.$refs.indexDataTable;
            // 通过API获取被选中的数据 
            let selectionRows = table.getSelectionRows();
            if (selectionRows == undefined || selectionRows.length == 0) {
                this.$message({
                    type: "info",
                    message: "您没有选中任何行"
                });
            }
            // console.log(selectionRows);
            // 可以进行批量改删除了
            //批量删除的第一件事
            //生产一个要删除的userId的数组
            let recordIds = [];

            //forEach 指的是从数组每一次取值是会赋值给user
            selectionRows.forEach(record => {
                // console.log(defect);
                recordIds.push(record.recordId);
            });
            console.log(recordIds);
            //调用API进行删除
            templateIndexRequst.deletes(recordIds, res => {
                this.$message({
                    type: "success",
                    message: "成功删除" + res.msg + "条数据"
                });
                this.loadTemplateIndex(this.currTempalateIndex.templateId);

            });
        },

        //多编辑按钮
        handlerEdit() {
            // 获取表格对象
            let table = this.$refs.indexDataTable;
            // 通过API获取被选中的数据 
            let selectionRows = table.getSelectionRows();
            if (selectionRows == undefined || selectionRows.length == 0) {
                this.$message({
                    type: "info",
                    message: "您没有选中任何行"
                });
            }
            // 获取第一行数据
            let row = selectionRows[0];
            // 调用行编辑事件
            this.handleDataEditIndex(row);


        },
        //取消按钮
        cancelEdits() {
            //关闭窗体
            this.indexEditDrawerIndex = false;
            //将数据制空
            this.updateTemplateIndex = {};

        },

        //编辑提交按钮
        doIndexEdits() {
            // 提交editIndex即可
            templateIndexRequst.edit(this.updateTemplateIndex, res => {
                // 这里的res就是我们的后端返回的perResult对象
                if (res.code == '200') {
                    this.$message({
                        message: '编辑成功',
                        type: 'success'
                    });
                    //关闭窗体
                    this.indexEditDrawerIndex = false;
                    // 重新加载数据
                    this.loadTemplateIndex(this.currTempalateIndex.templateId);
                    // 将editIndex制空
                    this.updateTemplateIndex = {};
                } else if (res.code == '300') {
                    this.$message({
                        message: '检测名称重复',
                        type: 'warning',
                    });
                } else {
                    this.$message({
                        message: '编辑失败',
                        type: 'error',
                    });
                }
            });


        },
        //检测增加弹窗确定
        doAddTemplateIndex() {
            this.newTemplateIndex.templateId = this.currTempalateIndex.templateId;
            // this.newTemplateIndex.templateId = 
            // console.log(currRouteProcess.templateId);
            templateIndexRequst.save(this.newTemplateIndex, res => {
                // 这里的res就是我们的后端返回的perResult对象
                if (res.code == '200') {
                    this.$message({
                        message: '添加成功',
                        type: 'success'
                    });
                    //关闭窗体
                    this.addDialogVisibleIndex = false;
                    this.loadTemplateIndex(this.currTempalateIndex.templateId);
                    // 将newDefect制空
                    this.newTemplateIndex = {};

                } else {
                    this.$message({
                        message: '添加失败',
                        type: 'error',
                    });
                }
            });
        },
        //检测增加弹窗取消
        cancelTemplateIndex() {
            //将数据制空
            this.newTemplateIndex = {},
                //关闭窗体
                this.addDialogVisibleIndex = false;
        },
        //检测表格删除
        handleDataDeleteIndex(row) {
            templateIndexRequst.delete(row.recordId, res => {
                if (res.code == 200) {
                    this.$message({
                        type: "success",
                        message: "删除成功"
                    });
                    this.loadTemplateIndex(this.currTempalateIndex.templateId);
                } else {
                    this.$message({
                        type: "error",
                        message: "删除失败"
                    });
                }
            })

        },
        //检测表格的编辑按钮
        handleDataEditIndex(row) {
            // 通过id加载要编辑的用户信息
            templateIndexRequst.gets(row.recordId, res => {
                // 将查询的用户信息设置到editUser中
                this.updateTemplateIndex = res.data;

                console.log(res.data);
                // 显示抽屉弹窗
                this.indexEditDrawerIndex = true;
            });


        },
        //检测增加弹窗搜索按钮数据
        //检测项新增搜索取消按钮
        cancelTempIndex() {
            this.searchIndex = false;//关闭窗体
        },
        //检测搜索提交按钮
        doAddTempIndex() {
            let table = this.$refs.indexTable; // 获取新增的表格对象
            let rows = table.getSelectionRows(); // 通过API获取被选中的数据
            this.newTemplateIndex.indexName = rows[0].indexName;
            this.newTemplateIndex.indexType = rows[0].indexType;
            this.newTemplateIndex.qcTool = rows[0].qcTool;
            console.log(this.newTemplateIndex.itemCode);

            this.updateTemplateIndex.indexName = rows[0].indexName;
            this.updateTemplateIndex.indexType = rows[0].indexType;
            this.updateTemplateIndex.qcTool = rows[0].qcTool;
            console.log(this.updateTemplateIndex.itemCode);
            this.searchIndex = false;
            //重新加载数据
            this.loadindex();


        },
        //列表的翻页函数
        changePageIndex(value) {
            this.inedxCurrPage = value;
            this.loadindex();
        },
        loadindex() {
            //加载数据
            indexRequst.list(this.inedxCurrPage, this.indexLimit,
                this.queryIndex, res => {
                    // 设置数据
                    this.indexs = res.data.list;
                    this.indexTotal = res.data.total;
                    this.indexMaxPage = res.data.pages;

                });

        },
        //检测项重置窗口按钮
        resetting() {
            // 将搜索数据制空
            this.queryIndex = {};
            this.loadindex();
        },
        //加载检测数据信息
        loadTemplateIndex(templateId) {
            console.log(templateId);
            templateIndexRequst.get(templateId, res => {
                console.log(res.data);
                this.templateIndexTable = res.data;
            });
        },

        // ============检测结束===========================
        //行提交编辑按钮
        doTemplateEdit() {
            this.autoTemplateCodes = false;
            // 提交editRefect即可
            templateRequst.edit(this.editTemplate, res => {
                // 这里的res就是我们的后端返回的perResult对象
                if (res.code == '200') {
                    this.$message({
                        message: '编辑成功',
                        type: 'success'
                    });
                    //关闭窗体
                    this.templateEditDrawer = false;
                    // 重新加载数据
                    this.loadteTemplate();

                    // 将数据制空
                    this.editTemplate = {};
                    //多选为空
                    this.editTemplate.templateType = {};
                } else if (res.code == '300') {
                    this.$message({
                        message: '缺陷类型重复',
                        type: 'warning',
                    });
                } else {
                    this.$message({
                        message: '编辑失败',
                        type: 'error',
                    });
                }
            });
        },
        // 取消编辑操作
        cancelEdit() {
            // 将编辑的用户制空
            this.editTemplate = {};
            // 关闭抽屉弹窗
            this.templateEditDrawer = false;
        },
        // 行编辑按钮
        handleEditTemplate(row) {
            // this.newTemplateIndex.templateId = row.templateId;
            // 通过id加载要编辑的用户信息
            templateRequst.get(row.templateId, res => {
                // 将查询的用户信息设置到editUser中
                this.editTemplate = res.data;
                // 显示抽屉弹窗
                this.templateEditDrawer = true;
            });
            //this.loadTemplateIndex(newTemplateIndex.templateId);
            this.loadTemplateIndex(row.templateId);
            this.currTempalateIndex = row;
            this.loadTemplateProduct(row.templateId);
            this.currTemplateProduct = row;

        },

        //点击编号查看信息按钮
        showTemplateData(templateId) {
            templateRequst.get(templateId, res => {
                // 将查询的用户信息设置到editUser中
                this.lookTemplate = res.data;
                this.loadteTemplate();
                this.DialogVisibles = true;
            });
        },
        //返回
        doTemplateReturn() {
            this.DialogVisibles = false;//关闭窗体
        },
        //取消
        cancelTemplateEdit() {
            this.DialogVisibles = false;//关闭窗体
        },
        //新增自动生成
        autoGenTemplateCode(val) {
            if (val) {
                genIdRequst.genTemplateCode(res => {
                    this.newTemplate.templateCode = res.data;
                });

            };
        },
        //编辑自动生成编码
        autoGenTemplateCodes(val) {
            if (val) {
                genIdRequst.genTemplateCode(res => {
                    this.editTemplate.templateCode = res.data;
                });
            };
        },
        //多编辑窗口
        handlerEditIndex() {
            // 获取表格对象
            let table = this.$refs.templateTable;
            // 通过API获取被选中的数据 
            let selectionRows = table.getSelectionRows();
            if (selectionRows == undefined || selectionRows.length == 0) {
                this.$message({
                    type: "info",
                    message: "您没有选中任何行"
                });
            }
            // 获取第一行数据
            let row = selectionRows[0];
            // 调用行编辑事件
            this.handleEditTemplate(row);
        },
        //工具栏-选中删除按钮事件
        handlerDeleteIndex() {
            // 获取表格对象
            let table = this.$refs.templateTable;
            // 通过API获取被选中的数据 
            let selectionRows = table.getSelectionRows();
            if (selectionRows == undefined || selectionRows.length == 0) {
                this.$message({
                    type: "info",
                    message: "您没有选中任何行"
                });
            }
            // console.log(selectionRows);
            // 可以进行批量改删除了
            //批量删除的第一件事
            //生产一个要删除的userId的数组
            let templateIds = [];
            //forEach 指的是从数组每一次取值是会赋值给user
            selectionRows.forEach(template => {
                templateIds.push(template.templateId);
            });
            console.log(templateIds);
            //调用API进行删除
            templateRequst.deletes(templateIds, res => {
                this.$message({
                    type: "success",
                    message: "成功删除" + res.msg + "条数据"
                });
                this.loadteTemplate();
            });
        },
        //行删除事件
        handleDeleteTemplate(row) {
            templateRequst.delete(row.templateId, res => {
                if (res.code == 200) {
                    this.$message({
                        type: "success",
                        message: "删除成功"
                    });
                    this.loadteTemplate();
                } else {
                    this.$message({
                        type: "error",
                        message: "删除失败"
                    });
                }
            })


        },
        //新增按钮事件
        doAddTemplate() {
            this.autoTemplateCode = false;
            console.log(this.newTemplate);
            this.newTemplate.templateType = this.templateType.join(",")
            templateRequst.save(this.newTemplate, res => {
                // 这里的res就是我们的后端返回的perResult对象
                if (res.code == '200') {
                    this.$message({
                        message: '添加成功',
                        type: 'success'
                    });
                    //关闭窗体
                    this.addDialogVisible = false;
                    // 重新加载数据
                    this.loadteTemplate();
                    // 将newDefect制空
                    this.newTemplate = {};
                    //多选为空
                    this.newTemplate.templateType = {};
                } else if (res.code == '300') {
                    this.$message({
                        message: '缺陷描述重复',
                        type: 'warning',
                    });
                } else {
                    this.$message({
                        message: '添加失败',
                        type: 'error',
                    });
                }
            });
        },
        //取消添加按钮事件
        cancelTemplate() {
            // 将newDefect制空
            this.newTemplate = {};
            // 关闭窗体
            this.addDialogVisible = false;
        },
        //缺陷列表的翻页函数
        changePagetemplate(value) {
            this.templateCurrPage = value;
            this.loadteTemplate();
        },

        // 加载数据
        loadteTemplate() {
            templateRequst.list(this.templateCurrPage, this.templateLimit,
                this.queryTemplate, res => {
                    // 设置数据
                    this.templates = res.data.list;
                    this.templateTotal = res.data.total;
                    this.templateMaxPage = res.data.pages;
                });
        },
        //重置操作
        resettingindex() {
            // 将newUser制空
            this.queryTemplate = {};
            this.loadteTemplate();

        },
    },
    mounted() {
        this.loadteTemplate();//加载数据
        this.loadindex();//加载检测数据
        this.loadItemType();
        this.loadItem();

    }
}


</script>


 